﻿using HighDiveEngine.Aggregates;
using HighDiveEngine.Model;
using HighDiveEngine.Resources;
using NUnit.Framework;

namespace UnitTestHighDive
{
    [TestFixture]
    class UnitTestDiveList
    {
        private DiveList diveList;

        [SetUp]
        public void SetUp()
        {
           UnitTestMockObjects.ResetObjects();
           diveList = new DiveList();
            diveList.Add(UnitTestMockObjects._dive11);
            diveList.Add(UnitTestMockObjects._dive21);
            diveList.Add(UnitTestMockObjects._dive31);
        }
        

        //[Test]
        //public void TestSortByTotalScore()
        //{
        //    Assert.AreEqual(, dlist[0].TotalScore);
        //    dlist.Sort(new DiveListComparer(DiveListSortType.TotalScore, false));
        //    Assert.AreEqual(47, dlist[0].TotalScore);
        //}

        [Test]
        public void TestSortByDiverName()
        {
            Diver diver = new Diver() {FirstName = "Egbert", LastName = "Haj"};
            Dive dive = new Dive() {Diver = diver, QueueOrderNumber = 10};
            diveList.Add(dive);
            Assert.AreEqual("Egbert", diveList[0].Diver.FirstName);
            Assert.AreEqual("hej", diveList[0].Diver.LastName);
            diveList.Sort(new DiveListComparer(DiveListSortType.DiverName));
            Assert.AreEqual("Egbert", diveList[1].Diver.FirstName);
            Assert.AreEqual("Haj", diveList[1].Diver.LastName);
            Assert.AreEqual("hej", diveList[2].Diver.LastName);
        }

        [Test]
        public void TestSortByQueueOrder()
        {
            Assert.AreEqual(1, diveList[0].QueueOrderNumber);
            diveList.Sort(new DiveListComparer(DiveListSortType.QueueOrderNumber,false));
            Assert.AreEqual(3, diveList[0].QueueOrderNumber);
        }
    }
}
